//模拟call实现，后面是一个一个参数
Function.prototype.myCall = function (context, ...args) {
    context = context || window;
    context.fn = this;
    let res = context.fn(...args);
    delete context.fn;
    return res;
}
function hello(name, age) {
    console.log(this.val + "--" + name + "--" + age);
}
let obj = {
    val: "hello"
}
hello.myCall(obj, "heiehi");
Function.prototype.myApply = function (context, arr) {
    context = context || window;
    context.fn = this;
    let result = context.fn(...arr);
    delete context.fn;
    return result;
}

hello.myApply(obj, ["haha", "xixi"]);

